<?php
	include 'php/config.php';
	session_start();
	if (!isset($_SESSION["id_utente"])) {
		header("Location: " . $ISSUER_HOST . "/login.php");
		exit();
	} else if (!$_SESSION["admin"]) {
		header("Location: " . $ISSUER_HOST . "/forbidden.html");
		exit();
	}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF8">
<script src="js/utils.js"></script>
<script src="js/insert_category.js"></script> 
<title>Insert Category</title>
</head>
<body>
<h1>New Category</h1>
	<div>
	<p>Da questa pagina è possibile creare una nuova categoria</p>
	</div>
	<form action="php/scripts/insert_category.php" method="post" enctype="multipart/form-data">
	<div>
	<label>Crea una categoria</label>
	</div>
	<table border="0">
		<tr>
			<td><label>Nome categoria</label></td>
			<td><input id="name" name="nome" type="text" maxLength="70" oninput="validateNewCategoryForm()" /></td>
		</tr>
		<tr>
			<td><label>Categoria padre</label></td>
			<td><textarea id="categoriaPadre" name="categoriaPadre" rows="1" cols="50" ></textarea></td>
		</tr>
	</table>
	<div id="message"></div>
	<input id="create" type="submit" value="Crea" disabled="disabled" />
	</form>
	<div>
	<p>Torna alla <a href="index.html">Home</a></p>
	</div>
</body>
</html>